//
//  PLVVodPlayerSkin.m
//  PolyvVodSDK
//
//  Created by BqLin on 2017/10/26.
//  Copyright © 2017年 POLYV. All rights reserved.
//

#import "PLVVodPlayerSkin.h"
#import <PLVVodSDK/PLVVodSDK.h>

#import "PLVVodSettingPanelView.h"
#import "PLVVodAudioCoverPanelView.h"
#import "UIView+PLVVod.h"
#import "PLVVodDanmuSendView.h"
#import "PLVVodDanmu+PLVVod.h"
#import "PLVVodDefinitionPanelView.h"
#import "PLVVodPlaybackRatePanelView.h"
#import "UIButton+EnlargeTouchArea.h"
#import <Photos/Photos.h>
#import "UIEnlargeButton.h"
#import "DPHFTopView.h"
#import "PLVUtils.h"
#import "UIView+DNImagePicker.h"
//#import"AppDelegate.h"
#import "DPCommonTool.h"
#import "Masonry.h"
#define isIpad(newCollection) (newCollection.verticalSizeClass == UIUserInterfaceSizeClassRegular && newCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular)

//屏幕宽高
#define SCREEN_WIDTH [UIScreen  mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

#define HexColor(rgbValue) UIColorFromRGBA(rgbValue, 1)
#define UIColorFromRGBA(rgbValue, alphaValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0x0000FF))/255.0 \
alpha:alphaValue]

#define PLVDelayDuration (2)
#define settingAnimateDuration  (0.2)
#define PLvLIveHeight (212)

#define  LL_iPhoneX   (IPHONE_X)
//iphonex及以上 所有设备宏
#define IPHONE_X \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})

#define iPhoneXBottomSafeHeight   (LL_iPhoneX ? 34:0)

static NSString *playerWillExitFullScreenNotificication = @"playerWillExitFullScreenNotificication";
static NSString *playerWillEnterFullScreenNotificication = @"playerWillEnterFullScreenNotificication";
static NSString *playerClickVbackBtnNotification = @"playerClickVbackBtnNotification";

@interface PLVVodPlayerSkin ()<UITextFieldDelegate>{
    BOOL _isSliding;
}


/// 综合设置面板
@property (strong, nonatomic) IBOutlet PLVVodSettingPanelView *settingsPanelView;

/// 清晰度选择面板
@property (strong, nonatomic) IBOutlet PLVVodDefinitionPanelView *definitionPanelView;

/// 速率选择面板
@property (strong, nonatomic) IBOutlet PLVVodPlaybackRatePanelView *playbackRatePanelView;

/// 分享平台选择面板
@property (strong, nonatomic) IBOutlet UIView *sharePanelView;

/// 音频封面面板
@property (strong, nonatomic) IBOutlet PLVVodAudioCoverPanelView *audioCoverPanelView;

/// 在面板的点击
@property (strong, nonatomic) IBOutlet UITapGestureRecognizer *panelTap;

/// 之前的约束
@property (nonatomic, strong) NSArray *priorConstraints;

/// 当前的播放控件视图
@property (nonatomic, weak) UIView *mainControl;

/// 顶层视图
@property (nonatomic, weak) UIView *topView;

/// 弹幕发送、配置视图
@property (strong, nonatomic) IBOutlet PLVVodDanmuSendView *danmuSendView;

/// 皮肤控件容器视图
@property (strong, nonatomic)  UIView *controlContainerView;
@property (nonatomic,strong)  UITapGestureRecognizer *tap ;
@property (nonatomic,assign) NSInteger scrubTime;

@property (nonatomic, strong) UIEnlargeButton *backBtn;
@property (nonatomic, strong) UILabel *vTitleLb;
@property (nonatomic, strong) UIEnlargeButton *danmuBtn;
@property (weak, nonatomic) IBOutlet UIView *topToolView;
@property (weak, nonatomic) IBOutlet UIView *videoLesftView;

@property (weak, nonatomic) IBOutlet UIStackView *videoRightView;
@property (nonatomic, strong) UIEnlargeButton *hDanmuBtn;
@property (nonatomic,assign) BOOL  isOrinPlay;



@property (nonatomic,assign) BOOL isDanmuOpen;
@property (nonatomic,assign) BOOL isVoicOpen;

//@property (nonatomic,strong) UIEnlargeButton *editBtn;

@property (nonatomic,strong) UIButton *hBackBtn;
@property (nonatomic,strong) UILabel *hTitleLb;
@property  (nonatomic,strong) UIView *vBottomView;
@property (nonatomic,strong) UIEnlargeButton *fullBtn;
@property (nonatomic,assign) BOOL isVideoPlay;
@property (nonatomic,assign)BOOL isOrientionChange;



@property (strong, nonatomic)  UIView *lockScreenView;

@property (nonatomic,strong) UILabel *fTimeLb;
@property (nonatomic,strong) DPQingxiSettingView *qxSettingView;
@property (nonatomic,strong) DPQingxiSettingView *suduSettingView;
//@property (nonatomic, copy) void(^clickFullZanBlock)(BOOL iszan);














@end

@implementation PLVVodPlayerSkin

#pragma mark - property
- (void)resetSettinViewHidden:(BOOL)isHiddden{
    self.qxSettingView.hidden = isHiddden;
    self.suduSettingView.hidden = isHiddden;
    
}
- (void)clickLockScreenBtn:(id)sender {
    self.isLockScreen = !self.isLockScreen;
    UIButton *btn = (UIButton *)sender;
    if (btn == self.lockScreenBtn) {
        
        if (self.lockScreenClickBlock) {
            self.lockScreenClickBlock(self.isLockScreen);
        }
    }
   
    NSString *imgName = @"全屏-锁屏-关";
    if (self.isLockScreen) {
        //锁屏状态
        imgName = @"全屏-锁屏-关";
        self.lockScreenView.hidden = NO;
    }else{
        //解锁屏 状态
        imgName = @"全屏-锁屏-开";
        self.lockScreenView.hidden = YES;
    }
    [self.lockScreenBtn setImage:[UIImage imageNamed:imgName] forState:UIControlStateNormal];
    
    
    
}
- (void)setMainControl:(UIView *)mainControl {
	if (_mainControl && mainControl) {
		[self transitFromView:self.topView toView:mainControl];
	}
	_mainControl = mainControl;
	if ([mainControl isKindOfClass:[PLVVodFullscreenView class]]) {
		PLVVodFullscreenView *playbackControl = (PLVVodFullscreenView *)mainControl;
#pragma mark 添加 横屏的自定义view
        [self addHoriTopViewOnView:playbackControl];
       
        [self addRightControlViewOnView:playbackControl];
        //隐藏掉 底部 操作view  只保留进度view 和进度slider******begin
        playbackControl.fullBottomView.frame = CGRectMake(0, SCREEN_HEIGHT-54-10, SCREEN_WIDTH, 54);
        playbackControl.fullBottomView.backgroundColor = [UIColor clearColor];
        playbackControl.fullBottomView.hidden = YES;
        self.fullShrinkscreenButton = playbackControl.switchScreenButton;
        //*************end
        [self resetBottomSubviewFramesWithSupview:playbackControl];
        
        
        self.lockScreenView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
        
        _lockScreenBtn.frame =  CGRectMake(50, (SCREEN_HEIGHT-26)/2, 26, 26);
         self.lockScreenBtn.hidden = NO;
        if (self.isLockScreen) {
            self.lockScreenView.hidden = NO;
           
        }else{
            self.lockScreenView.hidden = YES;
        }  
       
	} else if ([mainControl isKindOfClass:[PLVVodShrinkscreenView class]]) {
		PLVVodShrinkscreenView *playbackControl = (PLVVodShrinkscreenView *)mainControl;
#pragma mark 添加竖屏的自定义顶部view
        [self addVTopControlViewOnView:playbackControl];
		self.playPauseButton = playbackControl.playPauseButton;
        self.ctTimeLabel = playbackControl.cttimeLb;
//        CGFloat w = MIN(SCREEN_WIDTH, SCREEN_HEIGHT);
        self.lockScreenView.hidden = YES;
        self.lockScreenBtn.hidden = YES;
        NSString *timeText = self.timeLabel.text;
        if (timeText.length>0) {
            NSArray *strArray = [timeText componentsSeparatedByString:@"/"];
            NSLog(@"strArray:%@",strArray);
        }
		self.bufferProgressView = playbackControl.bufferProgressView;
		self.playbackSlider = playbackControl.playbackSlider;
        self.playbackSlider.center = CGPointMake(self.playbackSlider.center.x, self.bufferProgressView.centerY-2);
        
	}
    [self.playbackSlider addTarget:self action:@selector(handleTouchDown:) forControlEvents:UIControlEventTouchDown];
    [self.playbackSlider addTarget:self action:@selector(handleSlide:) forControlEvents:UIControlEventValueChanged];
    [self.playbackSlider addTarget:self action:@selector(handleTouchUp:) forControlEvents:UIControlEventTouchUpInside];
    [self.playbackSlider addTarget:self action:@selector(handleTouchUp:) forControlEvents:UIControlEventTouchUpOutside];
   _tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTap:)];
    [_tap setNumberOfTouchesRequired:1];
    [self.playbackSlider addGestureRecognizer:_tap];
    [self.playPauseButton setEnlargeEdgeWithTop:15 right:15 bottom:15 left:15];
}
#pragma mark  拖动播放花杆 相关方法 ------
- (void)handleTouchDown:(UISlider *)slider{
    NSLog(@"TouchDown -begin");
    self.isSlidebar = YES;
     self.scrubTime = self.delegatePlayer.currentPlaybackTime;
    
     [self showSliderPlayProgressGestureIndicator];
    [NSObject cancelPreviousPerformRequestsWithTarget:self];
    
    _tap.enabled = NO;
    _isSliding = YES;
//    self.isOrinPlay = (self.delegatePlayer.playbackState==PLVVodPlaybackStatePlaying)?YES:NO;
    self.isOrinPlay = YES;
}

- (void)handleTouchUp:(UISlider *)slider{
    NSLog(@"TouchUp---end");
    self.isSlidebar = NO;
//    [NSObject cancelPreviousPerformRequestsWithTarget:self];
    dispatch_async(dispatch_get_main_queue(), ^{
        [self performSelector:@selector(hideSlidePlayProgressGestureIndicator) withObject:nil afterDelay:PLVDelayDuration];
    });
   
    
    _tap.enabled = YES;
    _isSliding = NO;
//    BOOL isPlay = (self.delegatePlayer.playbackState==PLVVodPlaybackStatePlaying)?YES:NO;
    if(self.isOrinPlay){
        [self.delegatePlayer play];
    }else{
        [self.delegatePlayer pause];
    }
   
}
- (NSString *)convert:(CGFloat)time{
    int minute = time / 60;
    int second = time - minute * 60;
    NSString *minuteString;
    NSString *secondString;
    if(minute < 10){
        minuteString = [NSString stringWithFormat:@"0%d", minute];
    }else{
        minuteString = [NSString stringWithFormat:@"%d", minute];
    }
    if(second < 10){
        secondString = [NSString stringWithFormat:@"0%d", second];
    }else{
        secondString = [NSString stringWithFormat:@"%d", second];
    }
    return [NSString stringWithFormat:@"%@:%@", minuteString, secondString];
}
- (void)handleSlide:(UISlider *)slider{
    NSLog(@"tuodongvaluechanged");
    
    NSInteger duration = self.delegatePlayer.duration;
    self.scrubTime = (slider.value*duration);
    if (self.scrubTime > duration) { self.scrubTime = duration;}
    if (self.scrubTime < 0) { self.scrubTime = 0; }
    NSDateComponentsFormatter *formatter = [[NSDateComponentsFormatter alloc] init];
    NSString *currentTimeString = [formatter stringFromTimeInterval:self.scrubTime];
    NSString *durationString = [formatter stringFromTimeInterval:duration];
    NSInteger  minite = self.scrubTime/60;
    
    NSInteger  secs =(NSInteger) (self.scrubTime)%60;
    if (minite<100) {
        currentTimeString = [NSString stringWithFormat:@"%02ld:%02ld",(long)minite,(long)secs];
    }else{
        currentTimeString = [NSString stringWithFormat:@"%03ld:%02ld",(long)minite,(long)secs];
    }
    NSInteger  minite1 = duration/60;
    
    NSInteger  secs1 =(NSInteger) (duration)%60;
    if (minite<100) {
        durationString = [NSString stringWithFormat:@"%02ld:%02ld",(long)minite1,(long)secs1];
    }else{
        durationString = [NSString stringWithFormat:@"%03ld:%02ld",(long)minite1,(long)secs1];
    }
    CGFloat progressValue = 0;
    if (duration>0) {
        progressValue = slider.value;
    }
    if (slider.value==1) {
        currentTimeString = durationString;
    }
    PLVVodPlayerSkin *skin = (PLVVodPlayerSkin *)self.delegatePlayer.playerControl;
    //竖屏 的时候
    self.ctTimeLabel.text =currentTimeString;
    
    self.durationLb.text = durationString;
    
    NSString *text = [NSString stringWithFormat:@"%@/%@", currentTimeString, durationString];
    CGSize curTimeSize = [DPCommonTool getStrSizeWithString:text font:self.ntimeLb.font constraitSize:CGSizeMake(200, 20)];
    CGRect rect = self.ntimeLb.frame;
    rect.size.width = curTimeSize.width;
    skin.ntimeLb.frame = rect;
    skin.ntimeLb.text = text;
    [skin.playSliderView setPlayProgressTextWithCurrentText:currentTimeString TotalText:durationString prossValue:progressValue];
    //            skin.playIndView.text = text;
    skin.timeLabel.text =currentTimeString;
    skin.durationLb.text = durationString;
}
- (void)setTimeLbText:(CGFloat)value{
    self.scrubTime   = self.delegatePlayer.currentPlaybackTime;
      NSInteger duration = self.delegatePlayer.duration;
    if (self.scrubTime > duration) { self.scrubTime = duration;}
    if (self.scrubTime < 0) { self.scrubTime = 0; }
    NSDateComponentsFormatter *formatter = [[NSDateComponentsFormatter alloc] init];
    NSString *currentTimeString = [formatter stringFromTimeInterval:self.scrubTime];
    NSString *durationString = [formatter stringFromTimeInterval:duration];
    NSString *text = [NSString stringWithFormat:@"%@ / %@", currentTimeString, durationString];
    NSInteger  minite = self.scrubTime/60;
    
    NSInteger  secs =(NSInteger) (self.scrubTime)%60;
    if (minite<100) {
        currentTimeString = [NSString stringWithFormat:@"%02ld:%02ld",(long)minite,(long)secs];
    }else{
        currentTimeString = [NSString stringWithFormat:@"%03ld:%02ld",(long)minite,(long)secs];
    }
    NSInteger  minite1 = duration/60;
    
    NSInteger  secs1 =(NSInteger) (duration)%60;
    if (minite<100) {
        durationString = [NSString stringWithFormat:@"%02ld:%02ld",(long)minite1,(long)secs1];
    }else{
        durationString = [NSString stringWithFormat:@"%03ld:%02ld",(long)minite1,(long)secs1];
    }
    
    
    self.ctTimeLabel.text =currentTimeString;
    
    self.durationLb.text = durationString;
    NSString *curTime = [NSString stringWithFormat:@"%@/%@",currentTimeString,durationString];
    
    if (self.ntimeLb) {
        CGSize curTimeSize = [DPCommonTool getStrSizeWithString:curTime font:self.ntimeLb.font constraitSize:CGSizeMake(200, 20)];
        CGRect rect = self.ntimeLb.frame;
        rect.size.width = curTimeSize.width;
        self.ntimeLb.frame = rect;
        self.ntimeLb.text = curTime;
    }
}
- (void)handleTap:(UITapGestureRecognizer *)recognizer{
    NSLog(@"Tap");
    CGPoint touchPoint = [recognizer locationInView:self.playbackSlider];
    CGFloat value = touchPoint.x / CGRectGetWidth(self.playbackSlider.frame);
    [self.playbackSlider setValue:value animated:YES];
     BOOL isPlay = (self.delegatePlayer.playbackState==PLVVodPlaybackStatePlaying)?YES:NO;
    if(isPlay){
        [self.delegatePlayer pause];
    }
    CGFloat duration = self.delegatePlayer.duration;
    self.delegatePlayer.currentPlaybackTime = duration *value;

}
#pragma mark resetBottomSubviewFrames--------
- (void)resetBottomSubviewFramesWithSupview:(PLVVodFullscreenView *)playbackControl{
    self.bufferProgressView = playbackControl.bufferProgressView;
    self.playbackSlider = playbackControl.playbackSlider;
    self.playbackSlider .center = CGPointMake(self.playbackSlider.centerX, self.bufferProgressView.centerY);
    self.fBottView.frame = CGRectMake(0, SCREEN_HEIGHT-54+5, SCREEN_WIDTH, 54);
    self.fBottView.hidden = NO;
    self.fBottView.userInteractionEnabled = YES;
    self.qingxiBtn.frame = CGRectMake(SCREEN_WIDTH-19-46, (54-15)/2, 46, 15);
    
    

}
- (void)resetFullBottomState:(BOOL)isLubo{
    
}
- (void)resetFullZanFrameWithText:(NSString *)zanNum zanState:(BOOL)iszaned
{
    CGSize zanSize = [DPCommonTool getStrSizeWithString:zanNum font: [UIFont fontWithName:@"PingFangSC-Medium" size: 13] constraitSize:CGSizeMake(78, 15) lineSpace:0];
    self.fullZLb.text = zanNum;
    self.fullZLb.frame = CGRectMake(self.fullZLb.left, self.fullZLb.top, zanSize.width, 13);
    self.iszan = iszaned;
    NSString *name = @"";
    if (self.iszan) {
        name = @"shouye_icon_yishoucang";
    }else{
        name = @"点赞 线 白";
    }
    [self.fullZanBtn setImage:[UIImage imageNamed:name] forState:UIControlStateNormal];
}
- (UIView *)lockScreenView {
    if (!_lockScreenView) {
        _lockScreenView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
        _lockScreenView.backgroundColor = [UIColor clearColor];
        _lockScreenBtn.backgroundColor = [UIColor redColor];//test
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapLockScreen:)];
        tap.numberOfTapsRequired= 1;
        [_lockScreenView addGestureRecognizer:tap ];
        _lockScreenView.hidden = YES;
        _lockScreenView.hidden = YES;
        
    }
    return _lockScreenView;
    
}
- (void)tapLockScreen:(UITapGestureRecognizer *)tap{
    if (self.isLockScreen) {
        self.lockScreenBtn.hidden = !self.lockScreenBtn.hidden;
    }
    
}

- (void)addVBottomViewOnView:(UIView *)playbackControl {
    self.shrinkBottomView.hidden = YES;
    if (self.vBottomView) {
        [self.vBottomView removeFromSuperview];
    }
    self.vBottomView.hidden = YES;
    [playbackControl addSubview:self.vBottomView];
    [self.vBottomView addSubview:self.fullBtn];
    [self.fullBtn mas_makeConstraints:^(MASConstraintMaker *make){
        make.centerY.mas_equalTo(35/2);
        make.right.equalTo(self.vBottomView.mas_left).offset(SCREEN_WIDTH -15);
        make.size.mas_equalTo(CGSizeMake(15, 15));
    }];
    
    
}
- (void)addHoriTopViewOnView:(UIView *)playbackControl{
    self.topToolView.hidden = YES;
    self.fullBottomView.image = [UIImage imageNamed:@"danmu_beijing_xia"];
//    if (self.gestureIndicatorView) {
//         [self.gestureIndicatorView removeFromSuperview];
//    }
   
    if (self.hTopView) {
        [self.hTopView removeFromSuperview];
    }
    [playbackControl addSubview:self.hTopView];
    
     [self.view bringSubviewToFront:self.hTopView];
    [self.hTopView addSubview:self.hBackBtn];

    [self.hBackBtn mas_makeConstraints:^(MASConstraintMaker *make){
        make.left.equalTo(self.hTopView.mas_left).offset(17);
        make.size.mas_equalTo(CGSizeMake(12, 18));
        make.centerY.equalTo(self.hTopView.mas_centerY);
    }];
    [self.hTopView addSubview:self.hTitleLb];
    [self.hTitleLb mas_makeConstraints:^(MASConstraintMaker *make){
        make.left.equalTo(self.hBackBtn).offset(20);
        make.centerY.equalTo(self.hTopView);
        make.height.mas_equalTo(15);
    }];
//    [self.hTopView addSubview:self.hVoiceBtn];
    [self refreshVoiceBtnStateWithIsvoiceOpen:self.isVoicOpen];
////    [self.hVoiceBtn mas_makeConstraints:^(MASConstraintMaker *make){
//        make.size.mas_equalTo(CGSizeMake(25,28));
//        make.right.equalTo(self.hTopView.mas_right).offset(-15-iPhoneXBottomSafeHeight);
//        make.centerY.equalTo(self.hBackBtn.mas_centerY);
//    }];
    [self.hTopView addSubview:self.hDanmuBtn];
//    [self.hDanmuBtn mas_makeConstraints:^(MASConstraintMaker *make){
//        make.right.equalTo(self.hVoiceBtn.mas_left).offset(-20);
//        make.centerY.equalTo(self.hBackBtn);
//        make.size.mas_equalTo(CGSizeMake(20, 20));
//    }];
    
}


- (void)addRightControlViewOnView:(PLVVodFullscreenView *)playbackControl{
    
    self.videoRightView.hidden = YES;
    playbackControl.shareButton.hidden = YES;
    playbackControl.settingButton.hidden = YES;
//    self.ylSetttinView.hidden = NO;


//    if (self.isVoicOpen) {
//        self.ylSetttinView.hVolumeSlider.value = [[AppDelegate instance] getVolume];
//    }else{
//        self.ylSetttinView.hVolumeSlider.value = 0;
//    }
    CGFloat ylvalue = self.ylSetttinView.hVolumeSlider.value;
    NSString *ylStr = [NSString stringWithFormat:@"%d%%",(int)(ylvalue*100)];
    if (!self.isNeedRotate) {
        self.ylSetttinView.hVolumeSlider.frame = CGRectMake(0, 0, SCREEN_HEIGHT-83-40, 5);
        self.ylSetttinView.hVolumeSlider.center = CGPointMake(30, self.ylSetttinView.height/2+25);
        
        CGAffineTransform rotation =CGAffineTransformMakeRotation((-1)*M_PI_2);
        self.ylSetttinView.hVolumeSlider.transform = rotation;
        
        
        self.ylSetttinView.ylLb.frame = CGRectMake(0, self.ylSetttinView.hVolumeSlider.top-8-10, 60, 10);
        self.ylSetttinView.ylLb.text = ylStr;
        self.isNeedRotate = YES;
    }
    
    


}
- (void)addVTopControlViewOnView:(UIView *)playbackControl {
    self.shrinkBottomView.image = [UIImage imageNamed:@"danmu_beijing_xia"];
//    self.isDanmuOpen = NO;
//    self.isVoicOpen = YES;
//    self.isVideoPlay = YES;
    if (self.vTopView) {
        [self.vTopView removeFromSuperview];
        self.vTopView = nil;
    }
    [playbackControl addSubview:self.vTopView];
    [self.vTopView addSubview:self.backBtn];
   
    [self.vTopView addSubview:self.vTitleLb];
    self.vTitleLb.frame = CGRectMake(CGRectGetMaxX(self.backBtn.frame)+5,(CGRectGetMidY(self.backBtn.frame)-7.5), SCREEN_WIDTH -70, 15);
    self.backBtn.center = CGPointMake(self.backBtn.centerX, self.vTopView.centerY);
//    self.backBtn.center = CGPointMake( self.backBtn.center.x, self.vTitleLb.center.y);
    self.vTitleLb.center = CGPointMake(self.vTopView.center.x, self.backBtn.center.y);
    [self.vTopView addSubview:self.danmuBtn];
    if (self.isDanmuOpen) {
        [_danmuBtn setImage:[UIImage imageNamed:@"非全屏-弹幕-开"] forState:UIControlStateNormal];
    }else{
        
        [_danmuBtn setImage:[UIImage imageNamed:@"非全屏-弹幕-关"] forState:UIControlStateNormal];
    }
    self.skinMaskView.hidden = !self.isDanmuOpen;
    self.danmuBtn.frame = CGRectMake(SCREEN_WIDTH - 58-20, 2, 20, 20);
    self.danmuBtn.center =  CGPointMake(self.danmuBtn.center.x, self.backBtn.center.y);
     self.vTitleLb.frame = CGRectMake(CGRectGetMaxX(self.backBtn.frame)+20,(CGRectGetMidY(self.backBtn.frame)-7.5), self.danmuBtn.left -self.vTitleLb.left-10, 15);
//    [self.vTopView addSubview:self.voiceBtn];
//    self.voiceBtn.frame = CGRectMake(CGRectGetMaxX(self.danmuBtn.frame)+18, CGRectGetMinY(self.backBtn.frame), 25, 25);
//    AppDelegate *del = [AppDelegate instance];
//    CGFloat system = [del getVolume];
//
//    if (system ==0) {
//        self.isVoicOpen = NO;
//    }else{
//        self.isVoicOpen = YES;
//    }
//    [self refreshVoiceBtnStateWithIsvoiceOpen:self.isVoicOpen];
    
//    self.voiceBtn.center =  CGPointMake(self.voiceBtn.center.x, self.backBtn.center.y);

}
- (void)setTopView:(UIView *)topView {
	if (topView && _topView != topView && topView != self.fullscreenView && topView != self.shrinkscreenView && topView != self.gestureIndicatorView) {
		if ([_topView.gestureRecognizers containsObject:self.panelTap]) {
			[_topView removeGestureRecognizer:self.panelTap];
		}
		if (![topView.gestureRecognizers containsObject:self.panelTap]) {
			[topView addGestureRecognizer:self.panelTap];
		}
		self.shouldHideStatusBar = YES;
	} else {
		self.shouldHideStatusBar = NO;
	}
	_topView = topView;
}

- (void)setDelegatePlayer:(PLVVodPlayerViewController *)delegatePlayer {
	_delegatePlayer = delegatePlayer;
	if (!delegatePlayer) return;
	__weak typeof(self) weakSelf = self;
	//[self.delegatePlayer.doNotReceiveGestureViews addObject:self.shrinkscreenView];
	dispatch_async(dispatch_get_main_queue(), ^{
		[weakSelf.fullscreenView.backButton setTitle:delegatePlayer.video.title forState:UIControlStateNormal];
	});
}

- (void)setLocalPlayback:(BOOL)localPlayback {
	_localPlayback = localPlayback;
	dispatch_async(dispatch_get_main_queue(), ^{
		UIButton *definitionButton = self.fullscreenView.definitionButton;
		if (localPlayback) {
			[definitionButton setTitle:@"本地" forState:UIControlStateNormal];
			definitionButton.selected = NO;
			definitionButton.enabled = NO;
		} else {
			definitionButton.selected = YES;
			definitionButton.enabled = YES;
		}
	});
}

- (void)setEnableDanmu:(BOOL)enableDanmu {
	dispatch_async(dispatch_get_main_queue(), ^{
		self.fullscreenView.danmuButton.selected = enableDanmu;
	});
}
- (BOOL)enableDanmu {
	return self.fullscreenView.danmuButton.selected;
}

#pragma mark - PLVVodPlayerSkinProtocol

#pragma mark 字幕

- (void)setSubtitleKeys:(NSArray<NSString *> *)subtitleKeys {
	self.settingsPanelView.subtitleKeys = subtitleKeys;
}
- (NSArray<NSString *> *)subtitleKeys {
	return self.settingsPanelView.subtitleKeys;
}

- (void)setSelectedSubtitleKeyDidChangeBlock:(void (^)(NSString *))selectedSubtitleKeyDidChangeBlock {
	self.settingsPanelView.selectedSubtitleKeyDidChangeBlock = selectedSubtitleKeyDidChangeBlock;
}
- (void (^)(NSString *))selectedSubtitleKeyDidChangeBlock {
	return self.settingsPanelView.selectedSubtitleKeyDidChangeBlock;
}

- (void)setSelectedSubtitleKey:(NSString *)selectedSubtitleKey {
	self.settingsPanelView.selectedSubtitleKey = selectedSubtitleKey;
}
- (NSString *)selectedSubtitleKey {
	return self.settingsPanelView.selectedSubtitleKey;
}

#pragma mark 记号回放播放器设置清晰度----------

- (void)setQualityCount:(int)qualityCount {
	self.definitionPanelView.qualityCount = qualityCount;
}
- (int)qualityCount {
	return self.definitionPanelView.qualityCount;
}

- (void)setQuality:(PLVVodQuality)quality {
	self.definitionPanelView.quality = quality;
	NSString *definition = NSStringFromPLVVodQuality(quality);
	dispatch_async(dispatch_get_main_queue(), ^{
		UIButton *definitionButton = self.fullscreenView.definitionButton;
		[definitionButton setTitle:definition forState:UIControlStateNormal];
	});
}
- (PLVVodQuality)quality {
	return self.definitionPanelView.quality;
}

- (void)setQualityDidChangeBlock:(void (^)(PLVVodQuality))qualityDidChangeBlock {
	self.definitionPanelView.qualityDidChangeBlock = qualityDidChangeBlock;
}
- (void (^)(PLVVodQuality))qualityDidChangeBlock {
	return self.definitionPanelView.qualityDidChangeBlock;
}
#pragma mark 记号回放播放器设置清晰度----------end
#pragma mark 拉伸方式

- (void)setScalingMode:(NSInteger)scalingMode {
	self.settingsPanelView.scalingMode = scalingMode;
}
- (NSInteger)scalingMode {
	return self.settingsPanelView.scalingMode;
}
- (void)setScalingModeDidChangeBlock:(void (^)(NSInteger))scalingModeDidChangeBlock {
	self.settingsPanelView.scalingModeDidChangeBlock = scalingModeDidChangeBlock;
}
- (void (^)(NSInteger))scalingModeDidChangeBlock {
	return self.settingsPanelView.scalingModeDidChangeBlock;
}

#pragma mark 播放速率 设置方法 记号---------------------

- (void)setPlaybackRate:(double)playbackRate {
	NSString *title = [NSString stringWithFormat:@"%.1fx", playbackRate];
    //如果 重新设置播放速度，要重新重写下面代码 ，暂时先注释掉
    //******注释线******************
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.fullscreenView.playbackRateButton setTitle:title forState:UIControlStateNormal];
        [self.playbackRatePanelView setCurRate:playbackRate];
    });
    //*****注释线*******************
}

- (void)setSelectedPlaybackRateDidChangeBlock:(void (^)(double))selectedPlaybackRateDidChangeBlock {
	self.playbackRatePanelView.selectedPlaybackRateDidChangeBlock = selectedPlaybackRateDidChangeBlock;
}

- (void (^)(double))selectedPlaybackRateDidChangeBlock {
	return self.playbackRatePanelView.selectedPlaybackRateDidChangeBlock;
}

#pragma mark 音视频切换（PlaybackMode）
- (void)setUpPlaybackMode:(PLVVodVideo *)video {
    
    if ([video canSwithPlaybackMode]) {
        self.shrinkscreenView.playModeContainerView.hidden = NO;
        self.fullscreenView.playModeContainerView.hidden = NO;
        
        [self.audioCoverPanelView setCoverUrl:video.snapshot];
        [self.view addSubview:self.audioCoverPanelView];
        [self constrainSubview:self.audioCoverPanelView toMatchWithSuperview:self.view];
        [self.view sendSubviewToBack:self.audioCoverPanelView];
        
        [self updatePlayModeContainView:video];
    } else {
        self.shrinkscreenView.playModeContainerView.hidden = YES;
        self.fullscreenView.playModeContainerView.hidden = YES;
    }
}
- (void)setTopTitle:(NSString *)title{
    self.vTitleLb.text = title;
    self.hTitleLb.text = title;
}
- (void)updatePlayModeContainView:(PLVVodVideo *)video {
    if ([video canSwithPlaybackMode]) {
        PLVVodPlaybackMode playbackMode = self.delegatePlayer.playbackMode;
        [self.shrinkscreenView switchToPlayMode:playbackMode];
        self.vTitleLb.text = video.title;
        self.hTitleLb.text = video.title;
        [self.fullscreenView switchToPlayMode:playbackMode];
        [self.audioCoverPanelView switchToPlayMode:playbackMode];
    }
}

- (void)updateAudioCoverAnimation:(BOOL)isPlaying {
    if (isPlaying) {
        [self.audioCoverPanelView startRotate];
    } else {
        [self.audioCoverPanelView stopRotate];
    }
}

#pragma getter --
- (UIView *)skinMaskView
{
    if (!_skinMaskView){
        _skinMaskView = [[UIView alloc] init];
    }
    
    return _skinMaskView;
}

#pragma mark - view controller
- (void)releaseBlock{
    if (self.lockScreenClickBlock) {
        self.lockScreenClickBlock = nil;
    }
    if (self.danmuBtnClickBlock) {
        self.danmuBtnClickBlock = nil;
    }
    if (self.voicebtnClickBlock) {
        self.voicebtnClickBlock = nil;
    }
    if (self.playButtonClickBlock) {
        self.playButtonClickBlock = nil;
    }
    if (self.pauseButtonClickBlock) {
        self.pauseButtonClickBlock = nil;
    }
    if (self.fullScreenButtonClickBlock) {
        self.fullScreenButtonClickBlock = nil;
    }
    
    
    if (self.smallScreenButtonClickBlock) {
        self.smallScreenButtonClickBlock = nil;
    }
    if (self.editBtnClickBlock) {
        self.editBtnClickBlock = nil;
    }
    if (self.slideValueChangedBlock) {
        self.slideValueChangedBlock = nil;
    }
    if (self.tapPlayerScreenCallBackBlock) {
        self.tapPlayerScreenCallBackBlock = nil;
    }
    if (self.clickFullZanBlock) {
        self.clickFullZanBlock = nil;
    }
    if (self.tapVtopviewBlock) {
        self.tapVtopviewBlock = nil;
    }
    
    if (self.returnButtonClickBlock) {
        self.returnButtonClickBlock = nil;
    }
    [self removeOrientationObserve];
    [self.qxSettingView releaseBlock];
    self.qxSettingView = nil;
    [self.suduSettingView releaseBlock];
    self.suduSettingView = nil;
    [self.definitionPanelView releaseBlock];
    self.definitionPanelView = nil;
    [self.settingsPanelView releaseBlock];
    self.settingsPanelView = nil;
    [self.playbackRatePanelView releaseBlock];
    self.playbackRatePanelView = nil;
    self.delegatePlayer = nil;
    [NSObject cancelPreviousPerformRequestsWithTarget:self];
    [[NSNotificationCenter defaultCenter]removeObserver:self];
}

- (void)dealloc {
	[self removeOrientationObserve];
    [NSObject cancelPreviousPerformRequestsWithTarget:self];
    [[NSNotificationCenter defaultCenter]removeObserver:self];
    NSLog(@"%@-dealloc",NSStringFromClass(self.class));
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.isLockScreen = NO;
    self.isOrientionChange = NO;
	[self addOrientationObserve];
	[self setupUI];
    
}
- (void)createFullScreenBottomView{
    self.fullscreenView.fullBottomView.hidden = YES;
    
    self.fBottView = [[UIImageView alloc]initWithFrame:CGRectMake(0, SCREEN_HEIGHT-54, SCREEN_WIDTH, 54)];
    self.fBottView.image = [UIImage imageNamed:@"danmu_beijing_xia"];
//    self.fBottView.backgroundColor = [UIColor redColor];
    self.fBottView.hidden = NO;
    self.fBottView.userInteractionEnabled = YES;
    [self.fullscreenView addSubview:self.fBottView];
    [self.fBottView addSubview:self.fPlayBtn];
    NSString *name = @"plv_vod_play";
    if (self.delegatePlayer.playbackState == PLVVodPlaybackStatePlaying) {
        name = @"plv_vod_play";
       
    }else{
        name = @"plv_vod_btn_pause";
    }
     [self.fPlayBtn setImage:[UIImage imageNamed:name] forState:UIControlStateNormal];
    [self.fBottView addSubview:self.ntimeLb];
    [self.fBottView addSubview:self.qingxiBtn];
    [self.fBottView addSubview:self.suduBtn];
    if (!self.isLubo) {
        [self.fBottView addSubview:self.fullZanBtn];
        [self.fBottView addSubview:self.fullZLb];
        [self.fBottView addSubview:self.fullTextLb];
    }
    
    
    [self.fullscreenView addSubview:self.qxSettingView];
    [self.fullscreenView addSubview:self.suduSettingView];
    if (self.lockScreenView) {
        
        [self.lockScreenView removeFromSuperview];
        self.lockScreenView = nil;
    }
    [self.fullscreenView addSubview:self.lockScreenView];
    [self.fullscreenView addSubview:self.lockScreenBtn];

    
    
    
    
    
    
}
- (UIButton *)lockScreenBtn{
   
    if (!_lockScreenBtn) {
         CGFloat w = MIN(SCREEN_WIDTH, SCREEN_HEIGHT);
        _lockScreenBtn = [[UIButton alloc]initWithFrame:CGRectMake(50, (w-26)/2, 26, 26)];
        [_lockScreenBtn setImage:[UIImage imageNamed:@"全屏-锁屏-开"] forState:UIControlStateNormal];
//        _lockScreenBtn.backgroundColor = UIColorFromRGBA(0x000000, 0.2);
        [_lockScreenBtn addTarget:self action:@selector(clickLockScreenBtn:) forControlEvents:UIControlEventTouchUpInside];
        _lockScreenBtn.hidden = YES;
    }
    return _lockScreenBtn;
    
}
- (void)updateSliderTextWithValue:(CGFloat)value{
    self.ylSetttinView.ylLb.text =[NSString stringWithFormat:@"%d%%",(int)(value*100)];
    self.ylSetttinView.hVolumeSlider.value = value;
    [self sliderValueChanged: self.ylSetttinView.hVolumeSlider];
    
}
- (DPQingxiSettingView *)ylSetttinView{
//    WSelf(ws);
    __weak typeof(self)ws = self;
    if (!_ylSetttinView) {
        _ylSetttinView = [[DPQingxiSettingView alloc]initWithFrame:CGRectMake(SCREEN_HEIGHT-60, 0, 60, SCREEN_WIDTH) settingType:DPSettinTypeYinLiang];
//        [_ylSetttinView.hVolumeSlider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];
        _ylSetttinView.hidden = YES;
        _ylSetttinView.backgroundColor = UIColorFromRGBA(0x29282F, 0.8);
        _ylSetttinView.selectQingxiDuBlock = ^(NSString * _Nonnull selectTitle) {
          
            NSString *delStr = @"";
            if ([selectTitle containsString:@"X"]) {
                delStr = [selectTitle stringByReplacingOccurrencesOfString:@"X" withString:@""];
            }
            
            //选择后的@[@"0.5X",@"1X",@"1.2X",@"1.5X",@"2X"];/// 自动
            double selectRate = [delStr doubleValue];
            NSLog(@"selectRate:%f",selectRate);
            
//            if (ws.selectedPlaybackRateDidChangeBlock) {
//                ws.selectedPlaybackRateDidChangeBlock(selectRate);
//            }
            
        };
        
    }
    return _ylSetttinView;
}




- (DPQingxiSettingView *)suduSettingView{
//    WSelf(ws);
    __weak typeof(self)ws = self;
    if (!_suduSettingView) {
        _suduSettingView = [[DPQingxiSettingView alloc]initWithFrame:CGRectMake(SCREEN_HEIGHT-160, 0, 160, SCREEN_WIDTH) settingType:DPSettingSudu];
        _suduSettingView.hidden = YES;
        _suduSettingView.backgroundColor = UIColorFromRGBA(0x29282F, 0.8);
        _suduSettingView.selectQingxiDuBlock = ^(NSString * _Nonnull selectTitle) {
#pragma mark tag---------
//            ws.ylSetttinView.hidden = NO;
            NSString *delStr = @"";
            if ([selectTitle containsString:@"X"]) {
                delStr = [selectTitle stringByReplacingOccurrencesOfString:@"X" withString:@""];
            }
            
            //选择后的@[@"0.5X",@"1X",@"1.2X",@"1.5X",@"2X"];/// 自动
            double selectRate = [delStr doubleValue];
            NSLog(@"selectRate:%f",selectRate);
           
            if (ws.selectedPlaybackRateDidChangeBlock) {
                ws.selectedPlaybackRateDidChangeBlock(selectRate);
            }
            
        };
        
    }
    return _suduSettingView;
}
- (DPQingxiSettingView *)qxSettingView{
//    WSelf(ws);
    __weak typeof(self)ws = self;
    if (!_qxSettingView) {
        _qxSettingView = [[DPQingxiSettingView alloc]initWithFrame:CGRectMake(SCREEN_HEIGHT-160, 0, 160, SCREEN_WIDTH) settingType:DPSettingQingxidu];
        _qxSettingView.hidden = YES;
        _qxSettingView.backgroundColor = UIColorFromRGBA(0x29282F, 0.8);
        _qxSettingView.selectQingxiDuBlock = ^(NSString * _Nonnull selectTitle) {
            ws.qxSettingView.hidden = NO;
            //选择后的清晰度@[@"省流",@"流畅",@"高清",@"超清"]/// 自动
            PLVVodQuality  qulity =PLVVodQualityAuto;
            if ([selectTitle isEqualToString:@"省流"]||[selectTitle isEqualToString:@"流畅"]) {
                qulity = PLVVodQualityStandard;
            }
            else if ([selectTitle isEqualToString:@"高清"]){
                qulity = PLVVodQualityHigh;
            }
            else if ([selectTitle isEqualToString:@"超清"]){
                qulity = PLVVodQualityUltra;
            }
            [ws.delegatePlayer switchQuality:qulity];
//            [ws.delegatePlayer setVideo:ws.delegatePlayer.video quality:qulity];
            dispatch_async(dispatch_get_main_queue(), ^{
                if (ws.delegatePlayer.playbackState == PLVVodPlaybackStatePaused  ) {
                     [ws.delegatePlayer play];
                }
               
            });
            
            
        };
        
    }
    return _qxSettingView;
}
- (UILabel *)fullTextLb{
    if (!_fullTextLb) {
        _fullTextLb = [[UILabel alloc]initWithFrame:CGRectMake(self.ntimeLb.right+40,  (54-30)/2,self.fullZanBtn.left-15-(self.ntimeLb.right+40) ,30)];
        _fullTextLb.text = @" 添加评论…";
        _fullTextLb.userInteractionEnabled = YES;
        _fullTextLb.textColor = HexColor(0x75737E);
        _fullTextLb.font = [UIFont fontWithName:@"PingFangSC-Medium" size: 14];
        _fullTextLb.layer.borderWidth = 1;
        _fullTextLb.layer.cornerRadius = 15;
        _fullTextLb.layer.masksToBounds = YES;
        _fullTextLb.layer.borderColor = HexColor(0xFFFFFF).CGColor;
        UITapGestureRecognizer  *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapFullTextLb:)];
        tap.numberOfTapsRequired = 1;
        [_fullTextLb addGestureRecognizer:tap];
    }
    return _fullTextLb;
}
- (UILabel *)fullZLb{
    if (!_fullZLb) {
        _fullZLb = [[UILabel alloc]initWithFrame:CGRectMake(self.fullZanBtn.right+7,  (54-13)/2,32 ,13)];
        _fullZLb.text = @"0";
        _fullZLb.textColor = HexColor(0xffffff);
        _fullZLb.font = [UIFont fontWithName:@"PingFangSC-Medium" size: 13];
        _fullZLb.preferredMaxLayoutWidth = 70;
        
    }
    return _fullZLb;
}
- (UIEnlargeButton *)fullZanBtn {
    if (!_fullZanBtn) {
        _fullZanBtn = [[UIEnlargeButton alloc]initWithFrame:CGRectMake(self.suduBtn.left-78-26, (54-23)/2, 26, 23)];
        [_fullZanBtn setImage:[UIImage imageNamed:@"点赞 线 白"] forState:UIControlStateNormal];
        _fullZanBtn.imageView.contentMode = UIViewContentModeScaleAspectFill;
        [_fullZanBtn addTarget:self action:@selector(clickFPlay:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _fullZanBtn;
}
- (UIEnlargeButton *)qingxiBtn {
    if (!_qingxiBtn) {
        _qingxiBtn = [[UIEnlargeButton alloc]initWithFrame:CGRectMake(SCREEN_HEIGHT-19-46, (54-15)/2, 46, 15)];
        [_qingxiBtn setTitle:@"清晰度" forState:UIControlStateNormal];
        [_qingxiBtn setTitleColor:HexColor(0xffffff) forState:UIControlStateNormal];
        [_qingxiBtn.titleLabel setFont:[UIFont fontWithName:@"PingFangSC-Semibold" size: 15]];
        [_qingxiBtn addTarget:self action:@selector(clickFPlay:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return _qingxiBtn;
    
    
}
- (UIEnlargeButton *)suduBtn {
    if (!_suduBtn) {
        _suduBtn = [[UIEnlargeButton alloc]initWithFrame:CGRectMake(self.qingxiBtn.left-15-30, (54-15)/2, 30, 15)];
        [_suduBtn setTitle:@"速度" forState:UIControlStateNormal];
        [_suduBtn setTitleColor:HexColor(0xffffff) forState:UIControlStateNormal];
        [_suduBtn.titleLabel setFont:[UIFont fontWithName:@"PingFangSC-Semibold" size: 15]];
        [_suduBtn addTarget:self action:@selector(clickFPlay:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return _suduBtn;
    
    
}
- (UILabel *)ntimeLb {
    if (!_ntimeLb) {
        _ntimeLb = [[UILabel alloc]initWithFrame:CGRectMake(self.fPlayBtn.right+17, (54-13)/2, 76, 13)];
        _ntimeLb.backgroundColor = [UIColor clearColor];
        _ntimeLb.text = @"00:00/00:00";
        _ntimeLb.font =  [UIFont fontWithName:@"PingFangSC-Medium" size: 13];
        _ntimeLb.textColor  = HexColor(0xFFFFFF);
        
    }
    return _ntimeLb;
    
    
}
- (UIEnlargeButton *)fPlayBtn{
    if (!_fPlayBtn) {
        _fPlayBtn = [[UIEnlargeButton alloc]initWithFrame:CGRectMake(17, (54-18)/2, 18, 18)];
        [_fPlayBtn setImage:[UIImage imageNamed:@"plv_vod_play"] forState:UIControlStateNormal];
        [_fPlayBtn addTarget:self action:@selector(clickFPlay:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _fPlayBtn;
    
    
    
}
- (void)tapFullTextLb:(UITapGestureRecognizer *)tap{
   //点击假的fulltextlabel
    [self clickEditBtn];
    
    
}
- (void)clickFPlay:(UIButton *)btn{
    CGFloat w = MAX(SCREEN_WIDTH, SCREEN_HEIGHT);
    CGFloat h  = MIN(SCREEN_WIDTH, SCREEN_HEIGHT);
    if (btn == self.fPlayBtn) {
        NSString *name = @"";
        if (self.delegatePlayer.playbackState == PLVVodPlaybackStatePlaying) {
            [self.delegatePlayer pause];
            name = @"plv_vod_play";
            
        }else{
            [self.delegatePlayer play];
            
            name = @"plv_vod_btn_pause";
            
        }
        [self.fPlayBtn setImage:[UIImage imageNamed:name] forState:UIControlStateNormal];
    }
    if (btn == self.qingxiBtn) {
        //click qingxidu btn
        NSLog(@"clickQingxidu");
        self.ylSetttinView.hidden = YES;
        self.qxSettingView.hidden = NO;
        self.qxSettingView.frame = CGRectMake(w , 0, 160, h);
        [UIView animateWithDuration:settingAnimateDuration animations:^{
            self.qxSettingView.frame = CGRectMake(w -160, 0, 160, h);
        }];
        
    }
    if (btn == self.suduBtn) {
        //click sudu btn
        NSLog(@"clicksudubtn");
        self.ylSetttinView.hidden = YES;
        self.suduSettingView.hidden = NO;
        self.suduSettingView.frame = CGRectMake(w , 0, 160, h);
        [UIView animateWithDuration:settingAnimateDuration animations:^{
            self.suduSettingView.frame = CGRectMake(w -160, 0, 160, h);
        }];
    }
    if (btn == self.fullZanBtn) {
        //click bottom zanbtn
        NSLog(@"clickfullzanbtn");
        if (self.clickFullZanBlock) {
            self.clickFullZanBlock(self.iszan);
        }
        
    }
}
- (void)refeshQxsuduFrame{
    CGFloat w = MAX(SCREEN_WIDTH, SCREEN_HEIGHT);
    CGFloat h  = MIN(SCREEN_WIDTH, SCREEN_HEIGHT);
    if (!self.suduSettingView.hidden) {
        self.suduSettingView.frame = CGRectMake(w -160, 0, 160, h);
         self.qxSettingView.frame = CGRectMake(w -160, 0, 160, h);;
    }else{
         self.suduSettingView.frame = CGRectMake(w , 0, 160, h);
                self.qxSettingView.frame = CGRectMake(w , 0, 160, h);;
    }
    if (!self.qxSettingView.hidden) {
           self.suduSettingView.frame = CGRectMake(w -160, 0, 160, h);
          
       }else{
            self.qxSettingView.frame = CGRectMake(w , 0, 160, h);
           
       }
   
}
- (void)setupUI {
    self.isDanmuOpen = NO;
    self.isVoicOpen = YES;
    self.isVideoPlay = YES;
    CGFloat w = MIN(SCREEN_WIDTH, SCREEN_HEIGHT);
    self.shrinkscreenView.switchScreenButton.hidden = YES;
    self.shrinkscreenView.switchScreenButton.frame = CGRectMake(w-19-20, self.shrinkscreenView.cttimeLb.centerY-8, 20, 16);
    [self createFullScreenBottomView];
	[self updateUIForTraitCollection:self.traitCollection];
	
	self.topView = self.mainControl;
	[self.controlContainerView addSubview:self.mainControl];
//	self.priorConstraints = [self constrainSubview:self.mainControl toMatchWithSuperview:self.controlContainerView];
	
	[self.view addSubview:self.gestureIndicatorView];
    
//	[self constrainSubview:self.gestureIndicatorView toMatchWithSuperview:self.view];
	self.gestureIndicatorView.alpha = 0.5;
	
	// 配置控件细节
	self.subtitleLabel.text = @"";
#pragma mark 修改播放器轨道高度，滑块大小，--------yinliang_yuanquan
//    self.fullscreenView.bufferProgressView.transform =  CGAffineTransformMakeScale(1.0f,2.0f);
//    self.shrinkscreenView.bufferProgressView.transform =  CGAffineTransformMakeScale(1.0f,2.0f);
//    UIImage *playbackThumb = [UIImage imageNamed:@"sliderthumb"];
    UIImage *playbackThumb = [UIImage imageNamed:@"yinliang_yuanquan"];
	[self.fullscreenView.playbackSlider setThumbImage:playbackThumb forState:UIControlStateNormal];
    CGRect rect = self.fullscreenView.playbackSlider.frame;
    rect.size.height = 2;
    rect.origin.y  -=15;
    self.fullscreenView.playbackSlider.frame = rect;
    CGRect proRect = self.fullscreenView.bufferProgressView.frame;
    proRect.origin.y-=15;
    self.fullscreenView.bufferProgressView.frame=proRect;
    
	[self.shrinkscreenView.playbackSlider setThumbImage:playbackThumb forState:UIControlStateNormal];
    [self.shrinkscreenView.playbackSlider setMaximumTrackTintColor:[UIColor whiteColor]];
    [self.fullscreenView.playbackSlider setMaximumTrackTintColor:[UIColor whiteColor]];
    self.fullscreenView.playbackSlider.center = CGPointMake(self.fullscreenView.playbackSlider.center.x, self.fullscreenView.bufferProgressView.center.y);
    CGRect rect1 = self.shrinkscreenView.playbackSlider.frame;
    
    rect1.size.height = 2;
    self.shrinkscreenView.playbackSlider.frame = rect1;
     self.shrinkscreenView.playbackSlider.center = CGPointMake(self.shrinkscreenView.playbackSlider.center.x, self.shrinkscreenView.bufferProgressView.centerY);
	UIImage *settingThumb = [UIImage imageNamed:@"plv_vod_btn_slider_settings"];
	[self.settingsPanelView.volumeSlider setThumbImage:settingThumb forState:UIControlStateNormal];
	[self.settingsPanelView.brightnessSlider setThumbImage:settingThumb forState:UIControlStateNormal];
	
	__weak typeof(self) weakSelf = self;
	self.definitionPanelView.qualityButtonDidClick = ^(UIButton *sender) {
		[weakSelf backMainControl:sender];
	};
#pragma mark  播放速度 倍速按钮点击后回调 ------记号
	self.playbackRatePanelView.playbackRateButtonDidClick = ^(UIButton *sender) {
		[weakSelf backMainControl:sender];
	};
	
	// 链接属性
	self.brightnessSlider = self.settingsPanelView.brightnessSlider;
	self.volumeSlider = self.settingsPanelView.volumeSlider;
	
	// 自动隐藏控件
    [self fadeoutPlaybackControl];
    
    // 皮肤控件覆盖层，显示弹幕
    [self.view addSubview:self.skinMaskView];
    [self constrainSubview:self.skinMaskView toMatchWithSuperview:self.view];
    self.skinMaskView.backgroundColor = [UIColor clearColor];//test
    [self.view sendSubviewToBack:self.skinMaskView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }

#pragma mark - observe

- (void)addOrientationObserve {
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(interfaceOrientationDidChange:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
}

- (void)removeOrientationObserve {
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
}

- (void)interfaceOrientationDidChange:(NSNotification *)notification {
//      AppDelegate *del = [AppDelegate instance];
    self.isOrientionChange = YES;
	UIInterfaceOrientation interfaceOrientaion = [UIApplication sharedApplication].statusBarOrientation;
	switch (interfaceOrientaion) {
		case UIInterfaceOrientationPortrait:{
			
		}break;
		case UIInterfaceOrientationLandscapeLeft:
		case UIInterfaceOrientationLandscapeRight:
		case UIInterfaceOrientationPortraitUpsideDown:
		case UIInterfaceOrientationUnknown:{
			
		}break;
		default:{}break;
	}
//    del.allowRotation = YES;
//    if (del.allowRotation) {
//        [self updateUIForTraitCollection:self.traitCollection];
//    }
  
//    del.allowRotation = NO;
}

//- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
//    [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
//        [self updateUIForTraitCollection:newCollection];
//    } completion:nil];
//}

- (void)updateUIForTraitCollection:(UITraitCollection *)collection {
//    if (collection.verticalSizeClass == UIUserInterfaceSizeClassCompact) { // 横屏
//        self.mainControl = self.fullscreenView;
//        self.statusBarStyle = UIStatusBarStyleLightContent;
//        self.shouldHideNavigationBar = YES;
//    } else {
//        self.mainControl = self.shrinkscreenView;
//        self.statusBarStyle = UIStatusBarStyleDefault;
//        self.shouldHideNavigationBar = NO;
//    }
    
    BOOL fullScreen = NO;
    UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
    if (UIInterfaceOrientationIsLandscape(orientation)){
        fullScreen = YES;
    }
    else{
        fullScreen = NO;
    }
    
    if (fullScreen) { // 横屏
        
        self.mainControl = self.fullscreenView;
        self.statusBarStyle = UIStatusBarStyleLightContent;
        self.shouldHideNavigationBar = YES;
//        //点击竖屏下 的全屏按钮
        if (self.fullScreenButtonClickBlock) {
            self.fullScreenButtonClickBlock();
        }
       
    } else {
       
        self.mainControl = self.shrinkscreenView;
        self.statusBarStyle = UIStatusBarStyleDefault;
        self.shouldHideNavigationBar = YES;
        
         //点击横屏屏下 的回复竖屏按钮
        if (self.smallScreenButtonClickBlock) {
            self.smallScreenButtonClickBlock();
        }
    }
    
}

#pragma mark - orientation
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
//    AppDelegate *del = [AppDelegate instance];
//    del.allowRotation = YES;
}
- (void)switchScreen {
#pragma mark jihao
//    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
//    [[NSNotificationCenter defaultCenter] addObserver:self
//
//                                             selector:@selector(interfaceOrientationDidChange:)
//
//                                                 name:UIDeviceOrientationDidChangeNotification
//
//                                               object:nil];
//    // 当前控制器旋转至横屏

//    AppDelegate *del = [AppDelegate instance];
//    del.allowRotation = YES;
    
    UIInterfaceOrientation interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation;
    if (interfaceOrientation == UIInterfaceOrientationPortrait) {
        
        self.lockScreenBtn.hidden = YES;
        self.lockScreenView.hidden = YES;
//        del.rotateDirection = 1;
        
        [[NSNotificationCenter defaultCenter]postNotificationName:playerWillEnterFullScreenNotificication object:nil];
//        [del application:[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:del.window];
    
//        NSNumber *orientationUnknown = [NSNumber numberWithInt:0];
//        [[UIDevice currentDevice] setValue:orientationUnknown forKey:@"orientation"];

        
        [[UIDevice currentDevice]setValue:@(UIInterfaceOrientationLandscapeRight) forKey:@"orientation"];
        UIInterfaceOrientation orien = [UIApplication sharedApplication].statusBarOrientation;
        if (orien == UIInterfaceOrientationPortrait) {
             [[UIDevice currentDevice]setValue:@(UIInterfaceOrientationLandscapeLeft) forKey:@"orientation"];
            [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft;
             [[UIDevice currentDevice]setValue:@(UIInterfaceOrientationLandscapeRight) forKey:@"orientation"];
        }
        [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
        [self  setNeedsStatusBarAppearanceUpdate];
         [UIViewController attemptRotationToDeviceOrientation];
       
//        [PLVVodPlayerViewController rotateOrientation:UIInterfaceOrientationLandscapeRight];
//       [self switchNewOrientation:UIInterfaceOrientationPortrait];
//        [self switchNewOrientation:UIInterfaceOrientationLandscapeRight];
       
         if (self.fullScreenButtonClickBlock) self.fullScreenButtonClickBlock();
        
        
    } else {
        if (self.isLockScreen) {
            self.lockScreenBtn.hidden = NO;
            self.lockScreenView.hidden = NO;
        }else{
            self.lockScreenBtn.hidden = NO;
            self.lockScreenView.hidden = YES;
        }
        
        [[NSNotificationCenter defaultCenter]postNotificationName:playerWillExitFullScreenNotificication object:nil];
//        [PLVVodPlayerViewController rotateOrientation:UIInterfaceOrientationPortrait];
        [[UIDevice currentDevice]setValue:@(UIInterfaceOrientationPortrait) forKey:@"orientation"];
        [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait;
        [self  setNeedsStatusBarAppearanceUpdate];
        [UIViewController attemptRotationToDeviceOrientation];
       
    }
   
}
#pragma mark 控制手机是否锁定方向--begin
//- (BOOL)shouldAutorotate {
//    //    return self.selectedViewController.shouldAutorotate;
//    AppDelegate *del = [AppDelegate instance];
//
//    if (!del.allowRotation) {
//        return NO;
//    }else{
//        return YES;
//    }
//
//
//
//}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations  {
    //    return self.selectedViewController.supportedInterfaceOrientations;
//    AppDelegate *del = [AppDelegate instance];
//    if (!del.allowRotation) {
//        return UIInterfaceOrientationMaskPortrait;
//    }
    return UIInterfaceOrientationMaskAllButUpsideDown;
    
}
#pragma mark 控制手机是否锁定方向--end
- (void)switchNewOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    
    NSNumber *resetOrientationTarget = [NSNumber numberWithInt:UIInterfaceOrientationUnknown];
    
    [[UIDevice currentDevice] setValue:resetOrientationTarget forKey:@"orientation"];
    
    NSNumber *orientationTarget = [NSNumber numberWithInt:interfaceOrientation];
    
    [[UIDevice currentDevice] setValue:orientationTarget forKey:@"orientation"];
    
}


#pragma mark - action

- (IBAction)backMainControl:(id)sender {
	if (self.topView == self.mainControl) return;
	[self transitFromView:self.topView toView:self.mainControl];
    [self fadeoutPlaybackControl];
}

- (IBAction)switchScreenAction:(UIButton *)sender {
	[self switchScreen];
}

- (IBAction)danmuButtonAction:(UIButton *)sender {
	sender.selected = !sender.selected;
	self.fullscreenView.danmuSendButton.hidden = !sender.selected;
	if (self.enableDanmuChangeHandler) self.enableDanmuChangeHandler(self, sender.selected);
}

- (IBAction)definitionAction:(UIButton *)sender {
	[self transitToView:self.definitionPanelView];
}
#pragma mark 点击 播放速度设置按钮，弹出速度设置面板----记号---可参考
- (IBAction)playbackRateAction:(UIButton *)sender {
	[self transitToView:self.playbackRatePanelView];
}

- (IBAction)backAction:(UIButton *)sender {
    
	// 切换到竖屏
	UIInterfaceOrientation interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation;
	if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
		[PLVVodPlayerViewController rotateOrientation:UIInterfaceOrientationPortrait];
	}
}

- (IBAction)shareAction:(UIButton *)sender {
	[self transitToView:self.sharePanelView];
}

- (IBAction)settingAction:(UIButton *)sender {
	[self transitToView:self.settingsPanelView];
    [self.settingsPanelView switchToPlayMode:self.delegatePlayer.playbackMode];
}

- (IBAction)snapshotAction:(UIButton *)sender {
	UIImage *snapshot = [self.delegatePlayer snapshot];
	NSLog(@"snapshot: %@", snapshot);
	// 请求图库权限
	__weak typeof(self) weakSelf = self;
	[self.class requestPhotoAuthorizationWithDelegate:self authorized:^{
		UIImageWriteToSavedPhotosAlbum(snapshot, weakSelf, @selector(image:didFinishSavingWithError:contextInfo:), nil);
	}];
}

-  (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {
	if (error == nil) {
		[self showMessage:@"截图保存成功"];
	} else {
		[self showMessage:@"截图保存失败"];
	}
}

- (IBAction)danmuAction:(UIButton *)sender {
	[self transitToView:self.danmuSendView];
}

- (void)sendDanmu {
	PLVVodDanmu *danmu = [[PLVVodDanmu alloc] init];
	danmu.content = self.danmuSendView.danmuContent;
	danmu.colorHex = self.danmuSendView.danmuColorHex;
	danmu.fontSize = self.danmuSendView.danmuFontSize;
	danmu.mode = self.danmuSendView.danmuMode;
	danmu.time = self.delegatePlayer.currentPlaybackTime;
	[danmu sendDammuWithVid:self.delegatePlayer.video.vid completion:^(NSError *error) {
		NSLog(@"send danmu error: %@", error);
	}];
}
- (void)sendDanmuWithContent:(NSString *)content ColorHex:(NSUInteger)colorHex FontSize:(CGFloat)fontSize {
    PLVVodDanmu *danmu = [[PLVVodDanmu alloc] init];
    danmu.content = content;
    if (colorHex == 0) {
        colorHex = 0xFFFFFF;
        danmu.colorHex = colorHex;
    }else{
    danmu.colorHex = colorHex;
    }
    danmu.fontSize = fontSize;
    danmu.mode = PLVVodDanmuModeRoll;
    danmu.time = self.delegatePlayer.currentPlaybackTime;
    [danmu sendDammuWithVid:self.delegatePlayer.video.vid completion:^(NSError *error) {
        NSLog(@"send danmu error: %@", error);
        if (error) {
//            [self.view makeToast:[NSString stringWithFormat:@"发送弹幕失败：%@",[error description]]];
        }
    }];
}
- (IBAction)videoPlaybackModeAction:(id)sender {
    self.delegatePlayer.playbackMode = PLVVodPlaybackModeVideo;
}

- (IBAction)audioPlaybackModeAction:(id)sender {
    self.delegatePlayer.playbackMode = PLVVodPlaybackModeAudio;
}

#pragma mark - UITextFieldDelegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
	[self sendDanmu];
	[self backMainControl:textField];
	return NO;
}

#pragma mark - public method

- (void)showGestureIndicator {
	[UIView animateWithDuration:PLVVodAnimationDuration animations:^{
		self.gestureIndicatorView.alpha = 1;
	} completion:^(BOOL finished) {
		
	}];
}
- (void)showBrightnessGestureIndicator {
    [self hideAllIntroView];
    if (_brightIndView) {
        [_brightIndView removeFromSuperview];
        _brightIndView = nil;
    }
    [self.view addSubview:self.brightIndView];
//    self.brightIndView.alpha= 1;
    
    if ([self.mainControl isKindOfClass:[PLVVodFullscreenView class]]) {
        //quanping
    self.brightIndView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (SCREEN_HEIGHT-32)/2, 142, 32);
        
    }else{
       //shuping
 self.brightIndView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (self.view.height-32)/2, 142, 32);
    }
//    [UIView animateWithDuration:PLVVodAnimationDuration animations:^{
//        self.brightIndView.alpha =1;
//    } completion:^(BOOL finished) {
//
//    }];
}

- (void)showVolumeGestureIndicator {
    [self hideAllIntroView];
    if (_volumIndView) {
        [_volumIndView removeFromSuperview];
        _volumIndView = nil;
    }
    [self.view addSubview:self.volumIndView];
    
    
    if ([self.mainControl isKindOfClass:[PLVVodFullscreenView class]]) {
        //quanping
        self.volumIndView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (SCREEN_HEIGHT-32)/2, 142, 32);
        
    }else{
        //shuping
        self.volumIndView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (self.view.height-32)/2, 142, 32);
    }
//    [UIView animateWithDuration:PLVVodAnimationDuration animations:^{
//        self.volumIndView.alpha =1;
//    } completion:^(BOOL finished) {
    
//    }];
}
- (void)hideAllIntroView{
   
    if (_playIndView) {
        self.playIndView.alpha= 0;
      
    }
    if (_brightIndView) {
        self.brightIndView.alpha = 0;
    }
    if (_volumIndView) {
        self.volumIndView.alpha = 0;
    }
    if (_playSliderView) {
        _playSliderView.alpha = 0;
    }
}
- (void)showPlayProgressGestureIndicator {
   
    [self hideAllIntroView];
    if (_playIndView) {
        [_playIndView removeFromSuperview];
        _playIndView= nil;
    }
    [self.view addSubview:self.playIndView];
    
    
    if ([self.mainControl isKindOfClass:[PLVVodFullscreenView class]]) {
        //quanping
        self.playIndView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (SCREEN_HEIGHT-55)/2, 142, 55);
        
    }else{
        //shuping
        self.playIndView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (self.view.height-55)/2, 142, 55);
    }
//    [UIView animateWithDuration:PLVVodAnimationDuration animations:^{
//        self.playIndView.alpha =1;
//    } completion:^(BOOL finished) {
//
//    }];
}
- (void)showSliderPlayProgressGestureIndicator {
    
    [self hideAllIntroView];
    if (_playSliderView) {
        [_playSliderView removeFromSuperview];
        _playSliderView= nil;
    }
    [self.view addSubview:self.playSliderView];
    
    
    if ([self.mainControl isKindOfClass:[PLVVodFullscreenView class]]) {
        //quanping
        self.playSliderView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (SCREEN_HEIGHT-55)/2, 142, 55);
        
    }else{
        //shuping
        self.playSliderView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (self.view.height-55)/2, 142, 55);
    }
    //    [UIView animateWithDuration:PLVVodAnimationDuration animations:^{
    //        self.playIndView.alpha =1;
    //    } completion:^(BOOL finished) {
    //
    //    }];
}
- (DPAllDegreeIndicateView *)brightIndView{
    if (!_brightIndView) {
        _brightIndView = [[DPAllDegreeIndicateView alloc]initWithFrame:CGRectMake(0, 0, 142, 32) settingType:DPDegreeTypeBrightness];
        _brightIndView.alpha = 1;
//        _brightIndView.backgroundColor = [UIColor redColor];//test
        
    }
    return _brightIndView;
}
- (DPAllDegreeIndicateView *)volumIndView{
    if (!_volumIndView) {
        _volumIndView = [[DPAllDegreeIndicateView alloc]initWithFrame:CGRectMake(0, 0, 142, 32) settingType:DPDegreeTypeVolume];
        _volumIndView.alpha = 1;
      
        
    }
    return _volumIndView;
}
- (DPAllDegreeIndicateView *)playIndView{
    if (!_playIndView) {
        _playIndView = [[DPAllDegreeIndicateView alloc]initWithFrame:CGRectMake(0, 0, 142, 55) settingType:DPDegreeTypePlayProgress];
        _playIndView.alpha = 1;
    }
    return _playIndView;
    
}
- (DPAllDegreeIndicateView *)playSliderView{
    if (!_playSliderView) {
        _playSliderView = [[DPAllDegreeIndicateView alloc]initWithFrame:CGRectMake(0, 0, 142, 55) settingType:DPDegreeTypePlayProgress];
        _playSliderView.alpha = 1;
    }
    return _playSliderView;
    
}

-(void)refreshVodVolumandBrightFrame:(BOOL)isFull{
    [self refreshVodVolumFrame:isFull];
    [self refreshVodBrightFrame:isFull];
    [self refreshVodPlayIndFrame:isFull];
    [self refeshQxsuduFrame];
}
-(void)refreshVodBrightFrame:(BOOL)isFull{
    CGFloat h = 0;
    
    if (self.brightIndView) {
        if (isFull) {
            h = SCREEN_HEIGHT;
            
        }else{
            h=PLvLIveHeight;
        }
        self.brightIndView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (h-32)/2, 142, 32);
    }
    
}
- (void)refreshVodPlayIndFrame:(BOOL)isFull{
    CGFloat h = 0;
    
    if (self.playIndView) {
        if (isFull) {
            h = SCREEN_HEIGHT;
            
        }else{
            h=PLvLIveHeight;
        }
        self.playIndView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (h-55)/2, 142, 55);
    }
    if (self.playSliderView) {
        if (isFull) {
            h = SCREEN_HEIGHT;
            
        }else{
            h=PLvLIveHeight;
        }
        self.playSliderView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (h-55)/2, 142, 55);
    }
}
- (void)refreshVodVolumFrame:(BOOL)isFull{
    CGFloat h = 0;
    if (self.volumIndView) {
        if (isFull) {
            h = SCREEN_HEIGHT;
            
        }else{
            h=PLvLIveHeight;
        }
        self.volumIndView.frame = CGRectMake((SCREEN_WIDTH-142)/2, (h-32)/2, 142, 32);
    }
    
}
- (void)hideGestureIndicator {
	[UIView animateWithDuration:PLVVodAnimationDuration animations:^{
		self.gestureIndicatorView.alpha = 0;
	} completion:^(BOOL finished) {
		
	}];
}
- (void)hideBrightnessGestureIndicator {
   
    [UIView animateWithDuration:PLVVodAnimationDuration animations:^{
        self.brightIndView.alpha = 0;
    } completion:^(BOOL finished) {
        
    }];
}
- (void)hidevolumeGestureIndicator {
    [UIView animateWithDuration:PLVVodAnimationDuration animations:^{
        self.volumIndView.alpha = 0;
    } completion:^(BOOL finished) {
        
    }];
}
- (void)hidePlayProgressGestureIndicator {
    [UIView animateWithDuration:PLVVodAnimationDuration animations:^{
      
        self.playIndView.alpha = 0;
        [self.playIndView removeFromSuperview];
        self.playIndView = nil;
       
       
    } completion:^(BOOL finished) {
       
    }];
}
- (void)hideSlidePlayProgressGestureIndicator {
    [UIView animateWithDuration:PLVVodAnimationDuration animations:^{
        
        self.playSliderView.alpha = 0;
        [self.playSliderView removeFromSuperview];
        self.playSliderView = nil;
        
        
    } completion:^(BOOL finished) {
        
    }];
}
- (void)hideOrShowPlaybackControl {
    [NSObject cancelPreviousPerformRequestsWithTarget:self];
    self.controlContainerView.hidden = NO;
//    [self performSelector:@selector(setControlViewHidden) withObject:nil afterDelay:10];
//    if (self.topView != self.mainControl) return;
//    [self backMainControl:nil];

//    BOOL isShowing = self.controlContainerView.alpha > 0.0;
//    [UIView animateWithDuration:PLVVodAnimationDuration animations:^{
//        self.controlContainerView.alpha = isShowing ? 0 : 1;
//    } completion:^(BOOL finished) {
//        if (!isShowing && finished) {
////            [self fadeoutPlaybackControl];
//        }
//    }];
}
- (void)setControlViewHidden{
    self.controlContainerView.hidden = YES;
}
- (void)fadeoutPlaybackControl {
	[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(hideOrShowPlaybackControl) object:nil];
	[self performSelector:@selector(hideOrShowPlaybackControl) withObject:nil afterDelay:PLVVodAnimationDuration*10];
}

#pragma mark - tool

- (void)showMessage:(NSString *)message {
	UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:message preferredStyle:UIAlertControllerStyleAlert];
	[alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
		[alertController dismissViewControllerAnimated:YES completion:^{}];
	}]];
	[self presentViewController:alertController animated:YES completion:^{
		
	}];
}

+ (void)requestPhotoAuthorizationWithDelegate:(UIViewController *__weak)viewController authorized:(void (^)(void))authorizedHandler {
	authorizedHandler = ^(){
		dispatch_async(dispatch_get_main_queue(), ^{
			if (authorizedHandler) authorizedHandler();
		});
	};
	
	PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];
	switch (status) {
		case PHAuthorizationStatusNotDetermined:{
			// 请求权限
			[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
				switch (status) {
					case PHAuthorizationStatusAuthorized:{
						authorizedHandler();
					}break;
					default:{
						// 权限不允许
					}break;
				}
			}];
		}break;
		case PHAuthorizationStatusAuthorized:{
			authorizedHandler();
		}break;
		case PHAuthorizationStatusDenied:
		case PHAuthorizationStatusRestricted:{
			// 前往设置页
			NSString *message = [NSString stringWithFormat:@"无法获取您的照片权限，请前往设置"];
			UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:message preferredStyle:UIAlertControllerStyleAlert];
			[alertController addAction:[UIAlertAction actionWithTitle:@"去设置" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                
                
                NSURL *settingURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
                if ([[UIApplication sharedApplication] canOpenURL:settingURL]) {
                    [[UIApplication sharedApplication] openURL:settingURL];
                } else {
                    NSLog(@"无法打开 URL: %@", settingURL);
                }

			}]];
			[viewController presentViewController:alertController animated:YES completion:nil];
		}break;
		default:{}break;
	}
}

// makes "subview" match the width and height of "superview" by adding the proper auto layout constraints
- (NSArray *)constrainSubview:(UIView *)subview toMatchWithSuperview:(UIView *)superview {
	subview.translatesAutoresizingMaskIntoConstraints = NO;
	NSDictionary *viewsDictionary = NSDictionaryOfVariableBindings(subview);

	NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[subview]|" options:0 metrics:nil views:viewsDictionary];
	constraints = [constraints arrayByAddingObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[subview]|" options:0 metrics:nil views:viewsDictionary]];
	[superview addConstraints:constraints];
    
//    // 视频自适应全屏用到
//    NSArray *constraints = [NSArray array];
	return constraints;
}

// 执行动画视图转场
- (void)transitToView:(UIView *)toView {
	[self transitFromView:self.mainControl toView:toView];
}
- (void)transitFromView:(UIView *)fromView toView:(UIView *)toView {
	if (fromView == toView || !fromView || !toView) {
		return;
	}
	[self transitFromView:fromView toView:toView options:UIViewAnimationOptionTransitionCrossDissolve];
}
- (void)transitFromView:(UIView *)fromView toView:(UIView *)toView options:(UIViewAnimationOptions)options {
	NSArray *priorConstraints = self.priorConstraints;
	[UIView transitionFromView:fromView toView:toView duration:0.25 options:options completion:^(BOOL finished) {
		if (priorConstraints != nil) {
			[self.controlContainerView removeConstraints:priorConstraints];
		}
	}];
	self.priorConstraints = [self constrainSubview:toView toMatchWithSuperview:self.controlContainerView];
	self.topView = toView;
}
- (void)addShadowOnBtn:(UIButton *)btn{
    btn.layer.shadowOffset =  CGSizeMake(0, 0);
    btn.layer.shadowRadius = 2;
    btn.layer.shadowColor = [UIColor blackColor].CGColor;
    btn.layer.shadowOpacity = 0.5;
}
#pragma mark ---新添加的按钮 点击方法
//点击竖屏返回按钮
- (void)clickShrinkBackBtn{
    NSLog(@"click vbackbtn");
    
    if (self.returnButtonClickBlock) {
        self.returnButtonClickBlock(NO);
    }else{
        [[NSNotificationCenter defaultCenter]postNotificationName:playerClickVbackBtnNotification object:nil];
    }
}
//dianji danmu kaiguan button
- (void)clickDanMuBtn{
    NSLog(@"click danmuBtn");
#pragma mark 暂时关闭弹幕------------
//    self.isDanmuOpen = !self.isDanmuOpen;//长远策略
    self.isDanmuOpen = NO;//暂时策略
    NSString *danmuImg = @"";
    if (self.isDanmuOpen) {
        danmuImg = @"非全屏-弹幕-开";
         self.skinMaskView.hidden= NO;
        
    }else{
        danmuImg = @"非全屏-弹幕-关";
         self.skinMaskView.hidden= YES;
    }
    [self.danmuBtn setImage:[UIImage imageNamed:danmuImg] forState:UIControlStateNormal];
    
   
    if (self.danmuBtnClickBlock) {
        self.danmuBtnClickBlock(self.isDanmuOpen);
    }
    
    
    
    
}
//点击声音开关按钮
- (void)clickVoiceBtn{
    NSLog(@"clickvoicebutton");
    self.isVoicOpen = !self.isVoicOpen;
    [self refreshVoiceBtnStateWithIsvoiceOpen:self.isVoicOpen];
  
    if (self.voicebtnClickBlock) {
        
        self.voicebtnClickBlock(self.isVoicOpen);
        
    }
    
    
    
}
- (void)clickHoriziDanmu{
    NSLog(@"clickHengping danmu");
    self.isDanmuOpen = !self.isDanmuOpen;
    NSString *danmuImg = @"";
    if (self.isDanmuOpen) {
        danmuImg = @"非全屏-弹幕-开";
        
    }else{
        danmuImg = @"非全屏-弹幕-关";
    }
    [self.hDanmuBtn setBackgroundImage:[UIImage imageNamed:danmuImg] forState:UIControlStateNormal];
    self.skinMaskView.hidden= !self.isDanmuOpen;
    if (self.danmuBtnClickBlock) {
        self.danmuBtnClickBlock(self.isDanmuOpen);
        
    }
    
    
}
- (void)refreshVoiceBtnStateWithIsvoiceOpen:(BOOL)isVoiceOpen{
    NSString *voiceImage = @"";
//    AppDelegate *del = [AppDelegate instance];
//    CGFloat sysVolume = [del getVolume];
//    if (sysVolume ==0) {
//        isVoiceOpen = NO;
//    }else{
//        isVoiceOpen = YES;
//    }
    self.isVoicOpen = isVoiceOpen;
    if (self.isVoicOpen) {
        voiceImage = @"yinliang_open";
        
        
    }else{
        
        voiceImage = @"yinliang_close";
        
    }
//    [self.voiceBtn setImage:[UIImage imageNamed:voiceImage] forState:UIControlStateNormal];
//    if (self.hVoiceBtn) {
//        [self.hVoiceBtn setImage:[UIImage imageNamed:voiceImage] forState:UIControlStateNormal];
//    }
}




- (void)clickHoriziVoiceBtn{
    NSLog(@"clickHeng voice button");
    
    self.isVoicOpen = !self.isVoicOpen;
    NSString *voiceImage = @"";
    if (self.isVoicOpen) {
        voiceImage = @"yinliang_open";


    }else{
//         self.rightControlView.hidden = YES;
        voiceImage = @"yinliang_close";
        //        self.player.volume = 0;
    }

//    [self.hVoiceBtn setImage:[UIImage imageNamed:voiceImage] forState:UIControlStateNormal];
//    [self.voiceBtn setImage:[UIImage imageNamed:voiceImage] forState:UIControlStateNormal];
    if (self.voicebtnClickBlock) {
        self.voicebtnClickBlock(self.isVoicOpen);
    }
    
}
#pragma mark 监听 声音调节器
- (void)sliderValueChanged:(UISlider *)slider {
    
    if (slider.value==0) {
        self.isVoicOpen = NO;
    }else{
        self.isVoicOpen = YES;
    }
   
    NSString *voiceImage = @"";
    if (self.isVoicOpen) {
        voiceImage = @"yinliang_open";
    }else{
        
        voiceImage = @"yinliang_close";
    }
//    [self.voiceBtn setImage:[UIImage imageNamed:voiceImage] forState:UIControlStateNormal];
//    [self.hVoiceBtn setImage:[UIImage imageNamed:voiceImage] forState:UIControlStateNormal];
    self.ylSetttinView.ylLb.text = [NSString stringWithFormat:@"%d%%",(int)(slider.value*100)];
    
    if (self.slideValueChangedBlock) {
        self.slideValueChangedBlock(slider.value);
    }
   
}
- (void)clickEditBtn{
    NSLog(@"editbtn click");
    if (self.editBtnClickBlock) {
        self.editBtnClickBlock();
    }
}
- (void)clickHoriBackBtn{
    NSLog(@"clickhoriBackBtn");
   
    
    [self switchScreen];
    BOOL isFull = YES;
    if (self.returnButtonClickBlock) {
        self.returnButtonClickBlock(isFull);
    }
    
}
- (void)shouhuiTcViw{
    if (self.qxSettingView&&self.qxSettingView.hidden == NO) {
        [self.qxSettingView CloseView];
    }
    if (self.suduSettingView&&self.suduSettingView.hidden == NO) {
        [self.suduSettingView CloseView];
    }
}
- (void)shrinkfullBtnClick{
    NSLog(@"shrinkfullbtnclick");
//    UIInterfaceOrientation statusOrition = [UIApplication sharedApplication].statusBarOrientation;
//    if (UIInterfaceOrientationIsPortrait(statusOrition)) {
//        [self.fullBtn setBackgroundImage:[UIImage imageNamed:@"plv_vod_btn_fullscreen"] forState:UIControlStateNormal];
//    }else{
//         [self.fullBtn setBackgroundImage:[UIImage imageNamed:@"heng_fanhui_quanping"] forState:UIControlStateNormal];
//    }
    [PLVVodPlayerViewController rotateOrientation:UIInterfaceOrientationLandscapeRight];
    if (self.smallScreenButtonClickBlock) {
        self.smallScreenButtonClickBlock();
    }
    
}


#pragma mark -lazyloading----
- (UIImageView *)vTopView {
    if (!_vTopView) {
        
        _vTopView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 60)];
        _vTopView.userInteractionEnabled = YES;
        _vTopView.image = [UIImage imageNamed:@"danmu_beijing_shang"];
#pragma mark redcolor
//        _vTopView.backgroundColor = [UIColor redColor];//test
        UITapGestureRecognizer *tapTop = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapVTopview:)];
        tapTop.numberOfTapsRequired = 1;
        [_vTopView addGestureRecognizer:tapTop];
    }
    return _vTopView;
}
- (void)tapVTopview:(UITapGestureRecognizer *)tap{
    NSLog(@"tapVtopview");
    if (self.tapVtopviewBlock) {
        self.tapVtopviewBlock();
    }
}

- (UIEnlargeButton *)backBtn {
    if (!_backBtn) {
        _backBtn = [[UIEnlargeButton alloc]initWithFrame:CGRectMake(17, 10, 12, 18)];
        [_backBtn setImage:[UIImage imageNamed:@"返回"] forState:UIControlStateNormal];
        [self addShadowOnBtn:_backBtn];
        [_backBtn addTarget:self action:@selector(clickShrinkBackBtn) forControlEvents:UIControlEventTouchUpInside];
    }
    return _backBtn;
}

- (UILabel *)vTitleLb {
    if (!_vTitleLb) {
        _vTitleLb = [[UILabel alloc]init];
        _vTitleLb.backgroundColor = [UIColor clearColor];//test
        _vTitleLb.textColor = HexColor(0xFFFFFF);
        _vTitleLb.font = [UIFont fontWithName:@"PingFangSC-Medium" size: 15];
        _vTitleLb.numberOfLines = 1;
        _vTitleLb.textAlignment = NSTextAlignmentLeft;
        _vTitleLb.lineBreakMode = NSLineBreakByTruncatingTail;
        _vTitleLb.text = @"HIPHOP讲解";
    }
    return _vTitleLb;
}
- (UIEnlargeButton *)danmuBtn {
    if (!_danmuBtn) {
        _danmuBtn = [[UIEnlargeButton alloc]init];
        _danmuBtn.imageView.contentMode = UIViewContentModeScaleAspectFill;
//        _danmuBtn .backgroundColor = UIColorFromRGBA(0x000000, 0.2);//test
        [self addShadowOnBtn:_danmuBtn];
        [_danmuBtn addTarget:self action:@selector(clickDanMuBtn) forControlEvents:UIControlEventTouchUpInside];
        [_danmuBtn setImage:[UIImage imageNamed:@"非全屏-弹幕-开"] forState:UIControlStateNormal];
#pragma mark 弹幕暂时隐藏，等下一期 再显示
//        [DPCommonTool setButton:_danmuBtn UnVaryImgeWithImageName:@"非全屏-弹幕-开"];
        _danmuBtn.hidden = YES;
    }
    return _danmuBtn;
}
//- (UIEnlargeButton *)voiceBtn {
//    if (!_voiceBtn) {
//        _voiceBtn = [[UIEnlargeButton alloc]init];
//        _voiceBtn.backgroundColor =[UIColor clearColor];
//        _voiceBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
//
//        [[_voiceBtn imageView] setContentMode:UIViewContentModeScaleAspectFill];
//
//
//        _voiceBtn.contentHorizontalAlignment= UIControlContentHorizontalAlignmentFill;//水平方向拉伸
//
//        _voiceBtn.contentVerticalAlignment = UIControlContentVerticalAlignmentFill;//垂直方向拉伸
////        [self addShadowOnBtn:_voiceBtn];
////        [_voiceBtn setImage:[UIImage imageNamed:@"yinliang_open"] forState:UIControlStateNormal];
////        [DPCommonTool setButton:_voiceBtn UnVaryImgeWithImageName:@"shu_yingliang_kai"];
//        [_voiceBtn addTarget:self action:@selector(clickVoiceBtn) forControlEvents:UIControlEventTouchUpInside];
//    }
//    return _voiceBtn;
//}
- (UIEnlargeButton *)hDanmuBtn {
    if (!_hDanmuBtn) {
        _hDanmuBtn = [[UIEnlargeButton alloc]init];
        _hDanmuBtn.imageView.contentMode = UIViewContentModeScaleAspectFill;
        _hDanmuBtn.backgroundColor = [UIColor clearColor];//test
        [_hDanmuBtn addTarget:self action:@selector(clickHoriziDanmu) forControlEvents:UIControlEventTouchUpInside];
        [self addShadowOnBtn:_hDanmuBtn];
        _hDanmuBtn.imageView.contentMode = UIViewContentModeScaleAspectFill;
        [_hDanmuBtn setImage:[UIImage imageNamed:@"非全屏-弹幕-开"] forState:UIControlStateNormal];
#pragma mark 等下一期再显示-------
        _hDanmuBtn.hidden = YES;
//        [DPCommonTool setButton:_hDanmuBtn UnVaryImgeWithImageName:@"非全屏-弹幕-开"];
    }
    return _hDanmuBtn;
}
//- (UIEnlargeButton *)hVoiceBtn {
//    if (!_hVoiceBtn) {
//        _hVoiceBtn = [[UIEnlargeButton alloc]init];
//        _hVoiceBtn.backgroundColor = [UIColor clearColor];//test
//        [_hVoiceBtn addTarget:self action:@selector(clickHoriziVoiceBtn) forControlEvents:UIControlEventTouchUpInside];
//        [self addShadowOnBtn:_hVoiceBtn];
////        [DPCommonTool setButton:_hVoiceBtn UnVaryImgeWithImageName:@"heng_yingliang_kai"];
//        [_hVoiceBtn setImage:[UIImage imageNamed:@"yinliang_open"] forState:UIControlStateNormal];
//    }
//    return _hVoiceBtn;
//}
- (UIImageView *)rightControlView {
    if (!_rightControlView) {
        _rightControlView = [[UIImageView alloc]init];
        _rightControlView.image = [UIImage imageNamed:@"danmu_beijing_you"];
        _rightControlView.userInteractionEnabled = YES;
        //        _sideControllView.backgroundColor = [UIColor whiteColor];//test
        _rightControlView.hidden = NO;
       
    }
    return _rightControlView;
}
- (UILabel *)ylLabel {
    if (!_ylLabel) {
        _ylLabel = [[UILabel alloc]init];
        _ylLabel.text = @"音量";
        _ylLabel.textColor = HexColor(0xFFFFFF);
        _ylLabel.font = [UIFont systemFontOfSize:12];
        _ylLabel.textAlignment = NSTextAlignmentCenter;
        _ylLabel.backgroundColor = [UIColor clearColor];
    }
    return _ylLabel;
}
- (UISlider *)hVolumeSlider {
    if (!_hVolumeSlider) {
        _hVolumeSlider = [[UISlider alloc]initWithFrame:CGRectZero];
        _hVolumeSlider.backgroundColor = [UIColor clearColor];//test
        _hVolumeSlider.minimumValue = 0;
        _hVolumeSlider.maximumValue = 1;
        [_hVolumeSlider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];
        _hVolumeSlider.value = 0.3;
        UIImage *stetchLeftTrack= [UIImage imageNamed:@"tab_beijing"];
        
        UIImage *stetchRightTrack = [DPCommonTool imageWithColor:[UIColor whiteColor]];
        
        //滑块图片
        UIImage *thumbImage = [UIImage imageNamed:@"yinliang_yuanquan"];//缺少图
        [_hVolumeSlider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
        [_hVolumeSlider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
        [_hVolumeSlider setThumbImage:thumbImage forState:UIControlStateNormal];
    }
    return _hVolumeSlider;
}
//- (UIEnlargeButton *)editBtn {
//    if (!_editBtn) {
//        _editBtn = [[UIEnlargeButton alloc]init];
//        [self addShadowOnBtn:_editBtn];
//        [DPCommonTool setButton:_editBtn UnVaryImgeWithImageName:@"bianji"];
//        [_editBtn addTarget:self action:@selector(clickEditBtn) forControlEvents:UIControlEventTouchUpInside];
//
//    }
//    return _editBtn;
//}
- (DPHFTopView *)hTopView {
    CGFloat leftM = (LL_iPhoneX?44:0);

    
    if (!_hTopView) {
        _hTopView = [[DPHFTopView alloc]initWithFrame:CGRectMake(leftM, 0, SCREEN_WIDTH-leftM-iPhoneXBottomSafeHeight, 60)];
        _hTopView.image = [UIImage imageNamed:@"danmu_beijing_shang"];
        _hTopView.userInteractionEnabled = YES;
//        _hTopView.backgroundColor = [UIColor redColor];//test
        UITapGestureRecognizer *tapTop = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapVTopview:)];
        tapTop.numberOfTapsRequired = 1;
        [_hTopView addGestureRecognizer:tapTop];
        
    }
    return _hTopView;
}
- (UIButton *)hBackBtn {
    if (!_hBackBtn) {
        _hBackBtn = [[UIButton alloc]init];
        [_hBackBtn setImage:[UIImage imageNamed:@"返回"] forState:UIControlStateNormal];
        [self addShadowOnBtn:_hBackBtn];
        _hBackBtn.backgroundColor = [UIColor clearColor];//test
        [_hBackBtn addTarget:self action:@selector(clickHoriBackBtn) forControlEvents:UIControlEventTouchUpInside];
    }
    return _hBackBtn;
}
- (UILabel *)hTitleLb {
    if (!_hTitleLb) {
        _hTitleLb = [[UILabel alloc]init];
       
        _hTitleLb.backgroundColor = [UIColor clearColor];//test
        _hTitleLb.textColor = HexColor(0xFFFFFF);
        _hTitleLb.font =  [UIFont fontWithName:@"PingFangSC-Medium" size: 15];
        _hTitleLb.numberOfLines = 1;
        _hTitleLb.textAlignment = NSTextAlignmentLeft;
        _hTitleLb.lineBreakMode = NSLineBreakByTruncatingTail;
        _hTitleLb.preferredMaxLayoutWidth = SCREEN_WIDTH -160;
        _hTitleLb.text = @"HIPHOP讲解";
    }
    return _hTitleLb;
}
- (UIView *)vBottomView {
    if (!_vBottomView) {
        UIView *vBottomView = [[UIView alloc]initWithFrame:CGRectMake(0, 187-35, SCREEN_WIDTH, 35)];
        _vBottomView = vBottomView;
        vBottomView.backgroundColor = UIColorFromRGBA(0x000000, 0.7);
    }
    return _vBottomView;
}
- (UIEnlargeButton *)fullBtn {
    if (!_fullBtn) {
        _fullBtn = [[UIEnlargeButton alloc]init];
        [_fullBtn addTarget:self action:@selector(shrinkfullBtnClick) forControlEvents:UIControlEventTouchUpInside];
        [_fullBtn setBackgroundImage:[UIImage imageNamed:@"quanping_fanhui@3x.png"] forState:UIControlStateNormal];
    }
    return _fullBtn;
}







@end
